<div *ngIf="stop" class="form-horizontal">
    <form #stopform="ngForm" novalidate>
    <div class="row">
        <div class="form-group col-sm-6">
            <label class="form-control-label">ID:</label>
            <input name="stop_id" [(ngModel)]="stop.stop_id" placeholder="站点ID" class="form-control" readonly/>
            <input name="trip_id" [(ngModel)]="stop.trip_id" placeholder="车次ID" class="form-control" readonly hidden/>
        </div>
        <div class="form-group col-sm-6">
            <label>站点名称:</label>
            <input #stop_name="ngModel" name="stop_name" [(ngModel)]="stop.stop_name" placeholder="站点名称" class="form-control" required />
            <span></span>
        </div>
    </div>
    <div class="row">
        <div class="form-group col-sm-6">
            <label>站点顺序:</label>
            <input name="stop_seq" [(ngModel)]="stop.stop_seq" placeholder="站点顺序" class="form-control" required/>
        </div>
        <div class="form-group col-sm-6">
            <label>到达时间:</label>
            <input name="arrive_time" #arrive_time="ngModel" [(ngModel)]="stop.arrive_time" placeholder="到达时间" class="form-control" 
            required pattern="^((1|0?)[0-9]|2[0-3]):([0-5][0-9])"/>
            <span style="color:red" [hidden]="arrive_time.valid || arrive_time.pristine">
                时间格式不正确。
            </span>
        </div>
    </div>
    <div class="row">
        <div class="form-group col-sm-6">
            <label>经度:</label>
            <input name="longitude" #longitude="ngModel" [(ngModel)]="stop.longitude" placeholder="经度" class="form-control" 
            required pattern="^[\-\+]?(0?\d{1,2}\.\d{1,5}|1[0-7]?\d{1}\.\d{1,5}|180\.0{1,5})$"/>
            <span style="color:red" [hidden]="longitude.valid || longitude.pristine">
                请输入正确的经度。
            </span>
        </div>
        <div class="form-group col-sm-6">
            <label>纬度:</label>
            <input name="latitude" #latitude="ngModel" [(ngModel)]="stop.latitude" placeholder="纬度" class="form-control" 
            required pattern="^[\-\+]?([0-8]?\d{1}\.\d{1,5}|90\.0{1,5})$"/>
            <span style="color:red" [hidden]="latitude.valid || latitude.pristine">
                请输入正确的纬度。
            </span>
        </div>
    </div>
    <div class="row">
        <div class="form-group col-sm-6">
            <label>站点类型:</label>
            <select name="stop_type" class="form-control" id="stop_type" [(ngModel)]="stop.stop_type">
            <option>A</option>
            <option>B</option>
            <option>C</option>
        </select>
        </div>
        <div class="form-group col-sm-6">
            <label for="status" class="form-control-label">是否有效:</label>
            <select name="status" class="col-sm-10 form-control" id="status" [(ngModel)]="stop.status">
                <option>YES</option>    
                <option>NO</option>
            </select>
        </div>
    </div>
    <div class="row">
        <div class="form-group">
            <div class="col-sm-1">
                <!--<button class="btn btn-danger" *ngIf="stop.stop_id" (click)="delete()">删除</button>-->
            </div>
            <div class="offset-sm-9 col-sm-1">
                <button class="btn btn-default" (click)="cancel()">取消</button>
            </div>
            <div class="col-sm-1">
                <button [disabled]="!stopform.form.valid" class="btn btn-primary" (click)="save()">保存</button>
            </div>
        </div>
    </div>
    </form>
</div>
